{# Print config given by user -#}
{{ user_config }}

{# Get list of fields set in the user config -#}
{% set ns = namespace(user_fields=[]) -%}
{% for line in user_config.split('\n')|map('trim')|reject('eq', '') -%}
{% set field = line.split('=')|first -%}
{% if field|list|first != '#' -%}
{{ ns.user_fields.append(field) -}}
{% endif -%}
{% endfor -%}
{% set user_fields = ns.user_fields|unique -%}

{# Print the default config, skipping fields set by the user -#}
{% for line in default_config.split('\n') -%}
{% if line|trim == '' or line|trim|list|first == '#' -%}
{{ line }}
{% elif (line|trim).split('=')|first not in user_fields -%}
{{ line }}
{% endif -%}
{% endfor -%}
